package com.fpx.metadata.service.impl;

import com.fpx.metadata.bean.po.User;
import com.fpx.metadata.service.UserService;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.stereotype.Service;

@Service
@Log4j2
public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {

    @Override
    public boolean login(User user) {
        user.setPassword(DigestUtils.md5Hex(user.getPassword()));
        return super.queryCount(user) > 0;
    }

    @Override
    public Integer saveSelect(User user) {
        user.setPassword(DigestUtils.md5Hex(user.getPassword()));
        return super.saveSelect(user);
    }

    @Override
    public Integer updateSelective(User user) {
        user.setPassword(DigestUtils.md5Hex(user.getPassword()));
        return super.updateSelective(user);
    }
}
